<?php

namespace App\Http\View\Composers;

use Illuminate\View\View;
use App\Services\MenuService;
class MenuComposer
{
    /**
     * 注入menuservice
     */
    private $menuService; 


    public function __construct(MenuService $menuService)
    {
        $this->menuService = $menuService;
    }


     /**
     * Bind data to the view.
     *
     * @param  View  $view
     * @return void
     */
    public function compose(View $view)
    {
        // dd($this->menuService->getMenuTree());
        $view->with('menusSidebar', $this->menuService->getMenuTree());
    }

}